From: Cosimo Cecchi Date: Mon, 27 Jun 2011 15:51:23 +0000 (-0400) Subject: automount: emit sounds when a drive is connected/disconnected X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~8061 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=5133c3e01044edff635a15a4af558c4875c03dd8;p=gnome-shell.git automount: emit sounds when a drive is connected/disconnected https://bugzilla.gnome.org/show_bug.cgi?id=653520 --- diff --git a/js/ui/automountManager.js b/js/ui/automountManager.js index 7a22e1d06..a34a28f35 100644 --- a/js/ui/automountManager.js +++ b/js/ui/automountManager.js @@ -98,6 +98,12 @@ AutomountManager.prototype = { this._volumeMonitor.connect('volume-removed', Lang.bind(this, this._onVolumeRemoved)); + this._volumeMonitor.connect('drive-connected', + Lang.bind(this, + this._onDriveConnected)); + this._volumeMonitor.connect('drive-disconnected', + Lang.bind(this, + this._onDriveDisconnected)); Mainloop.idle_add(Lang.bind(this, this._startupMountAll)); }, @@ -123,6 +129,30 @@ AutomountManager.prototype = { return false; }, + _onDriveConnected: function() { + // if we're not in the current ConsoleKit session, + // or screensaver is active, don't play sounds + if (!this.ckListener.sessionActive) + return; + + if (this._ssProxy.screenSaverActive) + return; + + global.play_theme_sound(0, 'device-added-media'); + }, + + _onDriveDisconnected: function() { + // if we're not in the current ConsoleKit session, + // or screensaver is active, don't play sounds + if (!this.ckListener.sessionActive) + return; + + if (this._ssProxy.screenSaverActive) + return; + + global.play_theme_sound(0, 'device-removed-media'); + }, + _onVolumeAdded: function(monitor, volume) { this._checkAndMountVolume(volume); },